package com.seculab.member.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.seculab.common.util.CipherUtil;
import com.seculab.member.domain.Member;
import com.seculab.member.service.MemberService;

@Controller
@RequestMapping("/member")
public class MemberController {
	
	@Autowired
	private MemberService memberService;
	
	@RequestMapping("regiMember")
	public void regiMember(Member member) throws Exception {
	}
	
	@RequestMapping("regiSuccess")
	public void regiSuccess(Member member) throws Exception {
	}	
	
	@RequestMapping("insertMember")
	public String insertMember(Member member) throws Exception {
		member.setReg_id(member.getId());
		member.setUpd_id(member.getId());
		
		String password = CipherUtil.encrypt(member.getPassword());
		member.setPassword(password);
		
		memberService.insertMember(member);
		return "redirect:/app/member/regiSuccess";
	}

}
